/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author TANGQUOCTUAN
 */
@Entity
@Table(name = "Customers", catalog = "TUNGA", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Customers.findAll", query = "SELECT c FROM Customers c"),
    @NamedQuery(name = "Customers.findRoles", query = "SELECT c FROM Customers c WHERE c.roles.roleId = :roleId"),
    @NamedQuery(name = "Customers.findCustID", query = "SELECT c FROM Customers c WHERE c.custID LIKE :custID"),
    @NamedQuery(name = "Customers.findCustByID", query = "SELECT c FROM Customers c WHERE c.custID = :custID"),
    @NamedQuery(name = "Customers.findReportCust", query = "SELECT c FROM Customers c WHERE c.custID LIKE :custID AND c.roles.roleId = :roleId"),
    @NamedQuery(name = "Customers.login", query = "SELECT c FROM Customers c WHERE c.custID = :custID AND c.password = :password"),
    @NamedQuery(name = "Customers.findByCustID", query = "SELECT c FROM Customers c WHERE c.custID = :custID"),
    @NamedQuery(name = "Customers.findByPassword", query = "SELECT c FROM Customers c WHERE c.password = :password"),
    @NamedQuery(name = "Customers.findByFname", query = "SELECT c FROM Customers c WHERE c.fname = :fname"),
    @NamedQuery(name = "Customers.findByLname", query = "SELECT c FROM Customers c WHERE c.lname = :lname"),
    @NamedQuery(name = "Customers.findByEmail", query = "SELECT c FROM Customers c WHERE c.email = :email"),
    @NamedQuery(name = "Customers.findByPhone", query = "SELECT c FROM Customers c WHERE c.phone = :phone"),
    @NamedQuery(name = "Customers.findByAddress", query = "SELECT c FROM Customers c WHERE c.address = :address")})
public class Customers implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CustID", nullable = false, length = 50)
    private String custID;
    @Basic(optional = false)
    @Column(name = "Password", nullable = false, length = 50)
    private String password;
    @Basic(optional = false)
    @Column(name = "Fname", nullable = false, length = 50)
    private String fname;
    @Basic(optional = false)
    @Column(name = "Lname", nullable = false, length = 50)
    private String lname;
    @Basic(optional = false)
    @Column(name = "Email", nullable = false, length = 50)
    private String email;
    @Basic(optional = false)
    @Column(name = "Phone", nullable = false, length = 50)
    private String phone;
    @Basic(optional = false)
    @Column(name = "Address", nullable = false, length = 50)
    private String address;
    @JoinColumn(name = "RoleId", referencedColumnName = "RoleId", nullable = false)
    @ManyToOne(optional = false)
    private Roles roles;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "customers")
    private List<BookRooms> bookRoomsList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "customers")
    private List<BookTables> bookTablesList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "customers")
    private List<OderFood> oderFoodList;

    public Customers() {
    }

    public Customers(String custID) {
        this.custID = custID;
    }

    public Customers(String custID, String password, String fname, String lname, String email, String phone, String address, Roles objrole) {
        this.custID = custID;
        this.password = password;
        this.fname = fname;
        this.lname = lname;
        this.email = email;
        this.phone = phone;
        this.address = address;
        this.roles = objrole;
    }

    public String getCustID() {
        return custID;
    }

    public void setCustID(String custID) {
        this.custID = custID;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getFname() {
        return fname;
    }

    public void setFname(String fname) {
        this.fname = fname;
    }

    public String getLname() {
        return lname;
    }

    public void setLname(String lname) {
        this.lname = lname;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Roles getRoles() {
        return roles;
    }

    public void setRoles(Roles roles) {
        this.roles = roles;
    }

    public List<BookRooms> getBookRoomsList() {
        return bookRoomsList;
    }

    public void setBookRoomsList(List<BookRooms> bookRoomsList) {
        this.bookRoomsList = bookRoomsList;
    }

    public List<BookTables> getBookTablesList() {
        return bookTablesList;
    }

    public void setBookTablesList(List<BookTables> bookTablesList) {
        this.bookTablesList = bookTablesList;
    }

    public List<OderFood> getOderFoodList() {
        return oderFoodList;
    }

    public void setOderFoodList(List<OderFood> oderFoodList) {
        this.oderFoodList = oderFoodList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (custID != null ? custID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Customers)) {
            return false;
        }
        Customers other = (Customers) object;
        if ((this.custID == null && other.custID != null) || (this.custID != null && !this.custID.equals(other.custID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Customers[custID=" + custID + "]";
    }
}
